home *** CD-ROM | disk | FTP | other *** search
/ An Invitation to the Roland World of Music / Roland - An Invitation To The Roland World Of Music.bin / vb / mmsystem / mmsys1 / form1.frm next >
Text File  |  1995-04-22  |  5KB  |  184 lines

  1. VERSION 2.00
  2. Begin Form main 
  3.    Caption         =   "Form1"
  4.    ClientHeight    =   3240
  5.    ClientLeft      =   1125
  6.    ClientTop       =   1605
  7.    ClientWidth     =   7425
  8.    Height          =   3645
  9.    Left            =   1065
  10.    LinkTopic       =   "Form1"
  11.    ScaleHeight     =   3240
  12.    ScaleWidth      =   7425
  13.    Top             =   1260
  14.    Width           =   7545
  15.    Begin PictureBox Bender 
  16.       DrawMode        =   6  'Invert
  17.       Height          =   2895
  18.       Left            =   6360
  19.       ScaleHeight     =   16383
  20.       ScaleMode       =   0  'User
  21.       ScaleWidth      =   1
  22.       TabIndex        =   9
  23.       Top             =   300
  24.       Width           =   975
  25.    End
  26.    Begin ListBox lst_sound_list 
  27.       Height          =   2175
  28.       Left            =   2940
  29.       TabIndex        =   5
  30.       Top             =   1020
  31.       Width           =   2175
  32.    End
  33.    Begin CommandButton Command2 
  34.       Caption         =   "All Sound Off"
  35.       Height          =   495
  36.       Left            =   1680
  37.       TabIndex        =   2
  38.       Top             =   60
  39.       Width           =   1755
  40.    End
  41.    Begin PictureBox Picture1 
  42.       Height          =   2895
  43.       Left            =   5760
  44.       ScaleHeight     =   127
  45.       ScaleMode       =   0  'User
  46.       ScaleWidth      =   405
  47.       TabIndex        =   4
  48.       Top             =   300
  49.       Width           =   435
  50.    End
  51.    Begin VScrollBar sb_play 
  52.       Height          =   2895
  53.       LargeChange     =   12
  54.       Left            =   5220
  55.       Max             =   127
  56.       TabIndex        =   3
  57.       Top             =   300
  58.       Width           =   435
  59.    End
  60.    Begin CommandButton Command1 
  61.       Caption         =   "Play Note C4"
  62.       Height          =   495
  63.       Left            =   60
  64.       TabIndex        =   1
  65.       Top             =   60
  66.       Width           =   1515
  67.    End
  68.    Begin ListBox List1 
  69.       Height          =   2175
  70.       Left            =   60
  71.       TabIndex        =   0
  72.       Top             =   1020
  73.       Width           =   2835
  74.    End
  75.    Begin Label Label4 
  76.       AutoSize        =   -1  'True
  77.       Caption         =   "Bender"
  78.       Height          =   195
  79.       Left            =   6360
  80.       TabIndex        =   10
  81.       Top             =   60
  82.       Width           =   615
  83.    End
  84.    Begin Label Label3 
  85.       AutoSize        =   -1  'True
  86.       Caption         =   "Play here"
  87.       Height          =   195
  88.       Left            =   5220
  89.       TabIndex        =   6
  90.       Top             =   60
  91.       Width           =   810
  92.    End
  93.    Begin Label Label2 
  94.       AutoSize        =   -1  'True
  95.       Caption         =   "Sounds"
  96.       Height          =   195
  97.       Left            =   2940
  98.       TabIndex        =   8
  99.       Top             =   720
  100.       Width           =   645
  101.    End
  102.    Begin Label Label1 
  103.       AutoSize        =   -1  'True
  104.       Caption         =   "Devices"
  105.       Height          =   195
  106.       Left            =   120
  107.       TabIndex        =   7
  108.       Top             =   660
  109.       Width           =   705
  110.    End
  111. End
  112. Option Explicit
  113.  
  114. Sub Bender_MouseMove (Button As Integer, Shift As Integer, x As Single, y As Single)
  115. Static last_y_value As Single
  116.  
  117.     ' Remove previous line by overdrawing with inverted draw mode
  118.     ' scale width set from 0 to 1
  119.     bender.Line (0, last_y_value)-(1, last_y_value)
  120.     Call bender(0, y) ' scaleheight set to 0 to 16383
  121.     ' Draw new line
  122.     bender.Line (0, y)-(1, y)
  123.     last_y_value = y
  124. End Sub
  125.  
  126. Sub Command1_Click ()
  127.     Call note_on(0, 60, 127)
  128. End Sub
  129.  
  130. Sub Command2_Click ()
  131.     all_sounds_off
  132. End Sub
  133.  
  134. Sub fill_sound_list ()
  135. Dim s As String
  136.  
  137.     Open app.Path & "\genmidi.txt" For Input As #1
  138.     Do While Not EOF(1)
  139.         Line Input #1, s
  140.         lst_sound_list.AddItem s
  141.     Loop
  142.     Close #1
  143. End Sub
  144.  
  145. Sub Form_Load ()
  146.     Call midi_listoutdevs(list1)
  147.     Call fill_sound_list
  148. End Sub
  149.  
  150. Sub Form_Unload (Cancel As Integer)
  151.     midi_out_close
  152. End Sub
  153.  
  154. Sub List1_Click ()
  155. Dim x  As Integer
  156.  
  157.     midi_out_close
  158.     x = midi_out_open(list1.ItemData(list1.ListIndex))
  159. End Sub
  160.  
  161. Sub lst_sound_list_Click ()
  162.     Call program_change(0, 0, lst_sound_list.ListIndex)
  163. End Sub
  164.  
  165. Sub Picture1_MouseDown (Button As Integer, Shift As Integer, x As Single, y As Single)
  166.     Call note_on(0, y, 127)
  167. End Sub
  168.  
  169. Sub Picture1_MouseUp (Button As Integer, Shift As Integer, x As Single, y As Single)
  170.     Call note_off(0, y)
  171. End Sub
  172.  
  173. Sub sb_play_Change ()
  174. Static prev_note As Integer ' remember variable (static)
  175.  
  176.     ' Turn off previous note
  177.     Call note_off(0, prev_note)
  178.     ' turn on this note
  179.     Call note_on(0, sb_play.Value, 127) ' Max velocity
  180.     ' save note as previous
  181.     prev_note = sb_play.Value
  182. End Sub
  183.  
  184.